package com.madi.company.presenter;

import com.jaydenxiao.common.baserx.RxSubscriber;
import com.madi.company.bean.JobTypeEntity;
import com.madi.company.contract.JobTypeContract;

import java.util.List;
import java.util.Map;

/**
 * Created by 丁宁
 * on 2016/12/16.
 */

public class JobTypePresenter extends JobTypeContract.Presenter {
    @Override
    public void getData(String fileName) {
        mRxManage.add(mModel.getJobTypeData(fileName).subscribe(new RxSubscriber<List<JobTypeEntity>>(mContext,true) {
            @Override
            protected void _onNext(List<JobTypeEntity> jobTypeEntities) {
                mView.returnProfessionTypeData(jobTypeEntities);
                mView.stopLoading();
            }

            @Override
            protected void _onError(String message) {
                mView.stopLoading();
            }
        }));
    }

    @Override
    public void getSelectedData(Map<String, Integer> map) {
        mRxManage.add(mModel.getSelectedDatas(map).subscribe(new RxSubscriber<Map<String, Integer>>(mContext, false) {
            @Override
            protected void _onNext(Map<String, Integer> map) {
                mView.returnSelectedData(map);
            }
            @Override
            protected void _onError(String message) {

            }
        }));
    }
}
